//
//  cityViewController.m
//  WheatPlan
//
//  Created by 王晨辉 on 15/6/1.
//  Copyright (c) 2015年 IOSTeam. All rights reserved.
//

#import "cityViewController.h"
#import "CityChooseVC.h"
#import "MySideView.h"
@interface cityViewController (){
    
    CityChooseVC * city;
    
    
    
}

@end

@implementation cityViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //设置导航栏头文字
    self.navigationItem.title = @"选择省份";
    //设置导航栏背景颜色
    [self.navigationController.navigationBar setBarTintColor:UIColorWithRGBA(38, 176, 213, 1)];
    //设置导航栏字体颜色
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]];
    self.view.backgroundColor = [UIColor whiteColor];
    
    
    _sBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _sBtn.frame = CGRectMake(20, 285, SCREEN_WIDTH-40, 75);
    _sBtn.backgroundColor = [UIColor blackColor];
    _sBtn.tag =4;
    [_sBtn addTarget:self action:@selector(got2) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_sBtn];
        
    //注册通知
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tongzhi:) name:@"tongzhi" object:nil];
    
    
    
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString *passWord = [user objectForKey:@"bbbbbbb"];
    
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(20, 350, SCREEN_WIDTH-40, 75);
    btn.backgroundColor = [UIColor redColor];
    btn.tag =4;
    [btn addTarget:self action:@selector(got2) forControlEvents:UIControlEventTouchUpInside];
    [btn setTitle:[NSString stringWithFormat:@"%@",passWord] forState:UIControlStateNormal];
    [self.view addSubview:btn];
}


- (void)tongzhi:(NSNotification *)text{
    ////NSLog(@"%@",text.userInfo[@"textOne"]);
    ////NSLog(@"－－－－－接收到通知------");
    [_sBtn setTitle:[NSString stringWithFormat:@"%@%@",text.userInfo[@"textOne"],text.userInfo[@"textTwo"]] forState:UIControlStateNormal];
    
    
    
}

-(void)got2{
    
    
    CityChooseVC * cityVC = [[CityChooseVC alloc]init];
    UINavigationController * nav = [[UINavigationController alloc]initWithRootViewController:cityVC];
    [self presentViewController:nav animated:YES completion:nil];
    
    
    
}
-(void)turntolast{
    
    [self popoverPresentationController];
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
